package com.graduation.adminservice.controller;

import com.graduation.common.domain.dto.PageDTO;
import com.graduation.pojo.po.Comment;
import com.graduation.pojo.query.CommentQuery;
import com.graduation.pojo.vo.CommentVO;
import com.graduation.service.CommentService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/comment")
@RequiredArgsConstructor
public class CommentController {

    private final CommentService commentService;

    @GetMapping("/page")
    public PageDTO<CommentVO> pageComments(CommentQuery query) {
        return commentService.pageComments(query);
    }

    @DeleteMapping("/{id}")
    public void deleteComment(@PathVariable(name = "id") Long id) {
        commentService.deleteComment(id);
    }

    @GetMapping("/{id}")
    public CommentVO getById(@PathVariable(name = "id") Long id) {
        return commentService.getByCommentId(id);
    }

}
